#pragma once
#include <iostream>
#include <pthread.h>

class LockGuard {
public:
    LockGuard(pthread_mutex_t* mtx)
        : _mtx(mtx)
    {
        pthread_mutex_lock(_mtx);
    }

    ~LockGuard() {
        pthread_mutex_unlock(_mtx);
    }
private:
    pthread_mutex_t* _mtx;
};